package com.zyh.homework.test6.domain;

public class Triangle extends Graphic{
    private double a;
    private double b;
    private double c;

    //构造方法
    public Triangle() {
    }
    public Triangle(double a, double b, double c) {
        this.a = a;
        this.b = b;
        this.c = c;
    }

    @Override
    public double getArea() {
        double s = (getA() + getB() + getC()) / 2;
        return Math.sqrt(s * (s - getA()) * (s - getB()) * (s - getC()));
    }

    @Override
    public double getPerimeter() {
        return getA()+getB()+getC();
    }

    @Override
    public String getInfo() {
        return "三角形的三条边分别是"+getA()+","+getB()+","+getC()+","+"面积是"+getArea()+",周长是"+getPerimeter();
    }

    public double getA() {
        return a;
    }

    public void setA(double a) {
        this.a = a;
    }

    public double getB() {
        return b;
    }

    public void setB(double b) {
        this.b = b;
    }

    public double getC() {
        return c;
    }

    public void setC(double c) {
        this.c = c;
    }

}
